package br.com.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import br.com.bean.LoginBean;

public class LoginDao {
	public boolean validaLogin(Connection conn, LoginBean login) throws SQLException{
		StringBuilder sb = new StringBuilder();
		PreparedStatement ps = null;
		ResultSet rs = null;
		sb.append("	select * from login	 	");
		sb.append("	where usuario = ? and 	");
		sb.append("	senha = ?				");
		try {
			ps = conn.prepareStatement(sb.toString());
			ps.setString(1, login.getUsuario());
			ps.setString(2, login.getSenha());
			rs = ps.executeQuery();
			if(rs.next()){
				return true;
			}
		} finally {
			ps.close();
			rs.close();
		}
		return false;
	}

}
